#include "BindingHeader.hpp"

CEGUI::Renderer* getRenderer()
{
	return CEGUI::System::getSingleton().getRenderer();
}

CEGUI::Window* getGUISheet()
{
	return CEGUI::System::getSingleton().getGUISheet();
}


void Bind_SupportClasses(lua_State* l)
{
	using namespace luabind;
	using namespace CEGUI;
	module(l,"Cegui")
		[
			def("getRenderer",&getRenderer)
			,
			def("getGUISheet",&getGUISheet)
			,
			class_<PropertySet>("PropertySet")
			.def("removeProperty",&PropertySet::removeProperty)
			.def("clearProperties",&PropertySet::clearProperties)
			.def("isPropertyPresent",&PropertySet::isPropertyPresent)
			.def("isPropertyDefault",&PropertySet::isPropertyDefault)
			.def("getPropertyHelp",&PropertySet::getPropertyHelp)
			.def("getPropertyDefault",&PropertySet::getPropertyDefault)
			.def("getProperty",&PropertySet::getProperty)
			.def("setProperty",&PropertySet::setProperty)			
			,
			class_<Renderer>("Renderer")
			.def("createTexture",(Texture&(Renderer::*)())&Renderer::createTexture)			
			.def("createTexture",(Texture&(Renderer::*)(const String&,const String&))&Renderer::createTexture)			
			.def("createTexture",(Texture&(Renderer::*)(const Size&))&Renderer::createTexture)
			,
			class_<RenderEffect>("RenderEffect")
			.property("PassCount",&RenderEffect::getPassCount)
			.def("performPreRenderFunctions",&RenderEffect::performPreRenderFunctions)
			.def("performPostRenderFunctions",&RenderEffect::performPostRenderFunctions)
			.def("realiseGeometry",&RenderEffect::realiseGeometry)
			.def("update",&RenderEffect::update)
			,
			class_<Vertex>("Vertex")
			.def(constructor<>())
			.def_readwrite("Position",&Vertex::position)
			.def_readwrite("TexCoords",&Vertex::tex_coords)
			.def_readwrite("ColourVal",&Vertex::colour_val)
			,
			class_<GeometryBuffer>("GeometryBuffer")
			.def("draw",&GeometryBuffer::draw)
			.def("setTranslation",&GeometryBuffer::setTranslation)
			.def("setPivot",&GeometryBuffer::setPivot)
			.def("setClippingRegion",&GeometryBuffer::setClippingRegion)
			.def("appendVertex",&GeometryBuffer::appendVertex)
			.def("appendGeometry",&GeometryBuffer::appendGeometry)
			.property("ActiveTexture",&GeometryBuffer::getActiveTexture,&GeometryBuffer::setActiveTexture)
			.def("reset",&GeometryBuffer::reset)
			.property("VertexCount",&GeometryBuffer::getVertexCount)
			.property("BatchCount",&GeometryBuffer::getBatchCount)
			.property("RenderEffect",&GeometryBuffer::getRenderEffect,&GeometryBuffer::setRenderEffect)
		];
}